package ee.az.test.lighting;

/**
 * @author Artur Zinatullin (artur.zinatullin@gmail.com) 2010
 */
public class CornerPath extends Path {
	public <S extends Spot> CornerPath(AbstractMap<S> map, int startX, int startY, int endX, int endY) {
		super(map, startX, startY, endX, endY);
		boolean horizontalFirst = Math.random() > 0.5d;
		if (horizontalFirst) {
			Line lineHorizontal = map.getLine(startX, startY, endX, startY);
			copy(0, lineHorizontal);
			Line lineVertical = map.getLine(endX, startY, endX, endY);
			copy(lineHorizontal.getLength()-1, lineVertical);
		} else {
			Line lineVertical = map.getLine(startX, startY, startX, endY);
			copy(0, lineVertical);
			Line lineHorizontal = map.getLine(startX, endY, endX, endY);
			copy(lineVertical.getLength()-1, lineHorizontal);
		}
	}
}
